#include <iostream>

using namespace std;

const int N = 60;
int a[N];
int n;
int mmax = 0;

bool check()
{
    for(int i = 1;i <= n;i++)
    {
        if(mmax % a[i])
        {
            return false;
        }
        int x = mmax / a[i];
        if(x - (x & -x))
        {
            return false;
        }
    }
    return true;
}

int main()
{
    cin >> n;   
    for(int i = 1;i <= n;i++)
    {
        cin >> a[i];
        mmax = max(mmax,a[i]);
    }
    if(check())
    {
        cout << "YES" << endl;
    }
    else
    {
        cout << "NO" << endl;
    }
    return 0;
}